var moneyDetail;
var localData=[
	{"orderId":13132132586481,"phone":"15868721752","balance":30.5,"moneyChangeType":1,"dataTime":"2016-01-19 20:30","illustrate":"买买买"},
	{"orderId":13132132586481,"phone":"15868721753","balance":30.5,"moneyChangeType":2,"dataTime":"2016-01-19 20:30","illustrate":"买买买"},
	{"orderId":13132132586481,"phone":"15868721754","balance":31.5,"moneyChangeType":2,"dataTime":"2016-01-19 20:30","illustrate":"买买买"},
	{"orderId":13132132586481,"phone":"15868721755","balance":33.5,"moneyChangeType":1,"dataTime":"2016-01-19 20:30","illustrate":"买买买"}
]
$(function(){
	//渲染加载表格
	if($("#moneyDetail").length>0){
        moneyDetail = $.fn.bsgrid.init('moneyDetail', {
            localData: localData,   //本地json
            //url:'',               //数据地址
            // autoLoad: false,
            pageSizeSelect: true,
            pageSize: 10,
            stripeRows: true,
        });
    }
})
var money={
	//金额变动
    type:function(record, rowIndex, colIndex, options){
        var moneyType=moneyDetail.getRecordIndexValue(record, 'moneyChangeType');
        if(moneyType==1) return '<span class="sui-text-success">增加</span>';
        else if(moneyType==2) return '<span class="sui-text-danger">减少</span>';
    },
    //搜索
    search:function(){
        var form=$("#seach").serializeArray();
        moneyDetail.search(form);
    }
}
//修改金额
$("#userMoney").validate({
    rules:{
        money:{required:true,number:true},
        moneyChangeType:{required:true}
    }
})